#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
// #include "opencv2/nonfree/features2d.hpp"
// #include "opencv2/calib3d/calib3d.hpp"

#include "../../Common/defines.h"
// #include "../../Common/HsvImage.h"

#include <iostream>
using namespace std;
using namespace cv;

#pragma comment(lib, "opencv_core242d")
#pragma comment(lib, "opencv_features2d242d")
#pragma comment(lib, "opencv_imgproc242d")
#pragma comment(lib, "opencv_highgui242d")
// #pragma comment(lib, "opencv_calib3d242d")
// #pragma comment(lib, "opencv_nonfree242d")

int main(int argc, char** argv)
{
	// string imgFile = "../../InputFiles/Images/RGB.jpg";
	// Mat img = imread(imgFile, CV_LOAD_IMAGE_GRAYSCALE);

	Mat img = Mat::zeros(400, 400, CV_8UC1);
	ellipse(img, Point(200,200), Size(100, 80), 59.0, 0.0, 360.0, CV_RGB(255,255,255), CV_FILLED);
	
	Mat imgBin = img.clone();
	Mat resulImg = Mat::zeros(img.rows, img.cols, img.type());

	vector<vector<Point>> contours0;
	vector<vector<Point>>contours;
	contours.resize(contours0.size());

	findContours( imgBin, contours0, CV_RETR_EXTERNAL , CHAIN_APPROX_SIMPLE);
	drawContours( resulImg, contours0, -1 , Scalar(255,255,255), 1, CV_AA);

	double area = contourArea(contours0[0]);

	imshow("Origin", img);
	imshow("resulImg", resulImg);

	waitKey();
}